package com.ch04.service;

import org.springframework.beans.factory.DisposableBean;
import org.springframework.beans.factory.InitializingBean;

/**
 * @ClassName UserService
 * @Description TODO
 * @Author Kx
 * @Date 2025/4/28 9:04
 * @Version 1.0
 */
public class UserService implements InitializingBean, DisposableBean {
    public UserService() {
        System.out.println("UserService的构造方法");
    }

    /**
     * @author: kx
     * @date: 2025/4/28 11:32
     * @description: 自定义bean的初始化方法
    */
    public void initMethod() {
        System.out.println("由spring容器执行UserService的initMethod方法");
    }

    /**
     * @author: kx
     * @date: 2025/4/28 11:32
     * @description: 自定义bean的销毁方法
    */
    public void destroyMethod() {
        System.out.println("由spring容器执行UserService的destroyMethod方法");
    }

    @Override
    public void afterPropertiesSet() throws Exception {
        System.out.println("由spring容器执行UserService的afterPropertiesSet方法");
    }


    @Override
    public void destroy() throws Exception {
        System.out.println("由spring容器执行UserService的destroy方法");
    }
}
